<?php
class Component{
	var $_component_objs=array();
	function initialize($controller){
		$list=$controller->components;
		foreach($list as $key => $val){
			require_once('lib/components/'.$val.'.php');
			$classname=$val.'Component';
			$obj=new $classname($controller);
			$this->_component_objs[]=$obj;
			if(method_exists($obj,'initialize')){
				$obj->initialize($controller);
			}
		}
	}
	function startup($controller){
		foreach($this->_component_objs as $key => $obj){
			if(method_exists($obj,'startup')){
				$obj->startup($controller);
			}
		}
	}
	function beforeRender($controller){
		foreach($this->_component_objs as $key => $obj){
			if(method_exists($obj,'beforeRender')){
				$obj->beforeRender($controller);
			}
		}
	}
}